/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action.report;

import java.util.Date;

/**
 *
 * @author Trang
 */
public class Inventory  implements Comparable<Inventory>{
    private Integer productId;
    private String productName;
    private String productCode;
    private int stockQuantity;
    //private Date lastReceiptDate;
    private Date lastOrderDate;
    private long interval;
    private String timeBetween;
    private String lastOrder;
    
    
    public Inventory(String productName, String productCode, int stockQuantity, Date lastOrderDate, int interval, String timeBetween) {
        this.productName = productName;
        this.productCode = productCode;
        this.stockQuantity = stockQuantity;
        this.lastOrderDate = lastOrderDate;
        this.interval = interval;
        this.timeBetween = timeBetween;
    }

    public Inventory(Integer productId, String productName, String productCode, int stockQuantity, String timeBetween, String lastOrder, long interval) {
        this.productId = productId;
        this.productName = productName;
        this.productCode = productCode;
        this.stockQuantity = stockQuantity;
        this.timeBetween = timeBetween;
        this.lastOrder = lastOrder;
        this.interval = interval;
    }

    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }  

    public String getLastOrder() {
        return lastOrder;
    }

    public void setLastOrder(String lastOrder) {
        this.lastOrder = lastOrder;
    }
    
    

    public int getStockQuantity() {
        return stockQuantity;
    }

    public void setStockQuantity(int stockQuantity) {
        this.stockQuantity = stockQuantity;
    }

    public String getTimeBetween() {
        return timeBetween;
    }

    public void setTimeBetween(String timeBetween) {
        this.timeBetween = timeBetween;
    }
    
    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

//    public Date getLastReceiptDate() {
//        return lastReceiptDate;
//    }
//
//    public void setLastReceiptDate(Date lastReceiptDate) {
//        this.lastReceiptDate = lastReceiptDate;
//    }

    public Date getLastOrderDate() {
        return lastOrderDate;
    }

    public void setLastOrderDate(Date lastOrderDate) {
        this.lastOrderDate = lastOrderDate;
    }

    public long getInterval() {
        return interval;
    }

    public void setInterval(long interval) {
        this.interval = interval;
    }
    
    @Override
           public int compareTo(Inventory compareFruit) {
                            Long first =  this.getInterval();
                            Long second = compareFruit.getInterval();
//                            System.out.println(first +""+  second);
//                            System.out.println("Compare" + first.compareTo(second));
                            if(first/1000 == second/1000)
                            {
                                int firstQuan = this.getStockQuantity();
                                int secondQuan = compareFruit.getStockQuantity();
                                return (firstQuan - secondQuan);
                            }
                            else return first.compareTo(second);
 
	}

}
